package 面试.美团;

import java.util.Scanner;

/**
 * @author : K k
 * @date : 14:01 2020/9/13
 */
public class 美团4 {

    public static int buy(int n,int[] m,int k){
        int i=0;
        int res=0;
        for(i=0;i<n;i++){
            if(m[i]>=k){
                int j;
                //计算连续排列里，有多少个a不低于k
                for(j=i;j < n && m[j]>=k;j++);
                j = j-i;//共可以买j个
                res+=j*(j+1)/2;
                i+=j;
            }
        }
        return res;
    }
    public static void main(String[] args) {
        Scanner reader = new Scanner(System.in);
        System.out.println("Please input n,m,k");
        int n = reader.nextInt();
        int m = reader.nextInt();
        int[] cm = new int[m];
        int k = reader.nextInt();
        System.out.println("Please input a");
        for(int i = 0;i<n;i++){
            cm[i] = reader.nextInt();
        }
        System.out.println(buy(n,cm,k));
    }
}
